<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改记录</title>
    <script>
    function  showUserTip2() {
      document.getElementById('userTip2').innerHTML = '<b style="color: lightgray;">姓名不能为空</b>';
    }

    function  checkUser2() {
      var name = document.getElementById('2').value;
      if (name === ''){
        document.getElementById('userTip2').innerHTML = '<b style="color: red">姓名不能为空</b>'
        return 0;
      }else{
        document.getElementById('userTip2').innerHTML = '<b style="color:  green"> ok </b>'
        return 1;
      }
    }

    function  showUserTip3() {
      document.getElementById('userTip3').innerHTML = '<b style="color: lightgray;">生日不能为空</b>';
    }

    function  checkUser3() {
      var name = document.getElementById('3').value;
      if (name === ''){
        document.getElementById('userTip3').innerHTML = '<b style="color: red">生日不能为空</b>'
        return 0;
      }else{
        document.getElementById('userTip3').innerHTML = '<b style="color:  green"> ok </b>'
        return 1;
      }
    }
  </script>
</head>
<body>
<h3>请输入要修改记录的相关信息</h3>
<form id="form1" name="form1" method="post" action="/updatewx3">
    <label>学号：{{data[0]}}
        <input type="hidden" name="stu_id" value='{{data[0]}}'/>
<!--        定义隐藏的输入字段。-->
    </label>
    <p>
        <label>姓名：
            <input type="text" name="stu_name" value='{{data[1]}}'id="2" placeholder="输入姓名" onfocus="showUserTip2()" onblur="checkUser2()"/>
        </label>
        <span id="userTip2"></span>
    </p>
    <p>
        <label>性别：</label>
        {% if data[2]=="男" %}
        <label>
            <input name="stu_sex" type="radio" value="男" checked="checked"/>
            男</label>
        <label>
            <input type="radio" name="stu_sex" value="女"/>
            女</label>
        {%else%}
        <label>
            <input name="stu_sex" type="radio" value="男"/>
            男</label>
        <label>
            <input type="radio" name="stu_sex" value="女" checked="checked"/>
            女</label>
        {%endif%}
        <br/>
    </p>
    <p>
        <label>生日：
            <input type="text" name="stu_age" value='{{data[3]}}'id="3" placeholder="输入生日" onfocus="showUserTip3()" onblur="checkUser3()"/>
        </label>
        <span id="userTip3"></span>
    </p>
    <p>
        <label>所属班级：
            <select name="stu_origin">
                {% for pr in pro %}
                {% if pr[0]==data[4] %}
                {% set selected="selected" %}
                {% else %}
                {% set selected="" %}
                {% endif %}
                <option value='{{pr[0]}}' {{selected}}>{{pr[1]}}</option>
<!--                 <option value='{{pr[0]}}' {{"selected" if pr[0]==data[5]}}>{{pr[1]}}</option>-->
                {% endfor %}
<!--            <input type="text" name="stu_origin" value='{{data[4]}}'/>-->
            </select>
        </label>
    </p>
    <p>
        <label>
            <input type="submit" name="button" value="提交"/>
        </label>
        <label>
            <input type="reset" name="button2" value="重置"/>
        </label>
        <br/>
    </p>
</form>
</body>
</html>